﻿using LFSRecord2.Model.Undo;

namespace LFSRecord2.Model
{
    public class CustomStringKeyFrame : CustomKeyFrame
    {
        string _value = "";
        public string Value
        {
            get { return _value; }
            set
            {
                _value = value;
                OnPropertyChanged("Value");
            }
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        public CustomStringKeyFrame(int frame, string newValue)
            : base(frame)
        {
            _value = newValue;
            KeyFrameType = CustomKeyFrameTypes.String;

            InterpolationTypeIn = KeyFrameInterpolationTypes.Linear;
            InterpolationTypeOut = KeyFrameInterpolationTypes.Linear;
        }

        public override KeyFrameDataBase DataStructure()
        {
            KeyFrameStringData keyFrameData = new KeyFrameStringData()
            {
                UniqueID = UniqueID,
                KeyFrameType = KeyFrameType,
                ParentPropertyIndex = ParentProperty.PropertyIndex,
                ParentLayerIndex = ParentLayer.LayerIndex,
                IsSelected = IsSelected,
                FrameNum = FrameNum,
                KeyFrameIndex = KeyFrameIndex,
                EaseInValue = EaseInValue,
                EaseOutValue = EaseOutValue,
                InterpolationTypeIn = InterpolationTypeIn,
                InterpolationTypeOut = InterpolationTypeOut,
                Options = Options,
                DistanceToNextKeyFrame = DistanceToNextKeyFrame,
                BezierTime = BezierTime,

                Value = _value,
            };

            return keyFrameData;
        }
    }
}
